<?php
/*************************************************

消息模块主模型 - the
Author:  reload  <17-10-11>

*************************************************/
namespace Home\Model;
use Think\Model\RelationModel;
class MessageTypeModel extends RelationModel {
    public function get_all($map,$field='*',$page=1,$pagenum=999999) {
        $data = $this->where($map)->limit(($page-1)*$pagenum,$pagenum)->field($field)->select();
        return $data;
    }

    public function get_one($map) {
        $data = $this->where($map)->find();
        return $data;
    }


    public function edit_type($map,$postdata) {
        $res = $this->where($map)->save($postdata);
        return $res;
    }

    public function add_type($data) {
        $data = $this->data($data)->add();
        return $data;
    }

    public function count($map) {
        $count = M('MessageType')->where($map)->count();
        return $count;
    }

    public function del_type($map) {
        $res = $this->where($map)->delete();
        return $res;
    }
}